Module Items

Tuple Documentation of module_items.py
Each item record contains the following fields:
1) Item id: used for referencing items in other files.
    The prefix itm_ is automatically added before each item id.
2) Item name. Name of item as it'll appear in inventory window.
3) List of meshes. Each mesh record is a tuple containing the following fields:
  3.1) Mesh name.
  3.2) Modifier bits that this mesh matches.
         Note that the first mesh record is the default.
4) Item flags. See header_items.py for a list of available flags.
5) Item capabilities. Used for which animations this item is used with. See header_items.py for a list of available flags.
6) Item value.
7) Item stats: Bitwise-or of various stats about the item such as:
    weight, abundance, difficulty, head_armor, body_armor,leg_armor, etc.
8) Modifier bits: Modifiers that can be applied to this item.
9) [Optional] Triggers: List of simple triggers to be associated with the item.
10) [Optional] Factions: List of factions that item can be found as merchandise.

module_items.py begins with a number of constants that are used to govern item modifiers which adjust the items we see in-game. Bent polearms, chipped swords, heavy axes, they are all created from a tuple in module_items.py and then given an appropriate item modifier to adjust their stats up or down.

After the constants, the list of tuples begins. The first one of interest is the weapon "practice_sword", which will function as a good example. Let's look at this tuple:

								
									["practice_sword","Practice Sword", [("practice_sword",0)],
itp_type_one_handed_wpn|itp_primary|itp_secondary|itp_wooden_parry|itp_wooden_attack, itc_longsword,
3,weight(1.5)|spd_rtng(103)|weapon_length(90)|swing_damage(16,blunt)|thrust_damage(10,blunt),imodbits_none],

This is a basic practice weapon, used in the arena fights and training fields. Tuple examination of "practice_sword":

								
									1) Item id = "practice_sword"
2) Item name = "practice_sword"
3) List of meshes:
  3.1) Mesh name = "practice_sword"
  3.2) Modifier bits = 0
4) Item flags = itp_type_one_handed_wpn|itp_primary|itp_secondary|itp_wooden_parry|itp_wooden_attack
5) Item capabilities = itc_longsword
6) Item value = 3
7) Item stats = weight(1.5)|spd_rtng(103)|weapon_length(90)|swing_damage(16,blunt)|thrust_damage(10,blunt)
8) Modifier bits = imodbits_none
9) Triggers = None

We can now tell all of "practice_sword"'s details from its tuple:

  • It uses the mesh "practice_sword" as its default mesh
  • It uses item flags that mark it as a one-handed melee weapon. Troops who are equipped with "practice_sword" will consider "practice_sword" when choosing a primary melee weapon from their inventory listing. They will also consider "practice_sword" when choosing a backup (secondary) weapon. (Note: The secondary weapon function is currently nebulous. It's unclear when it's used or if it's used at all. However, melee troops certainly will not switch to different melee weapons during combat.)
  • It has all the animations defined in the constant itc_longsword, so "practice_sword" is able to be used as a long sword would be.
  • It weights 1.5 kilograms, its speed rating is 103 and its weapon length is 90. It does a base 16 blunt damage while swinging, and a base 10 blunt damage while thrusting.
  • It uses no item modifiers.

Item Types/Classes

There exists a range of item types which you should not confuse with item properties even if they have the same shorttag in front of their names.[1] The weapon item types decide which animations are getting used for the idle stance and movements of the agent carrying them.[2] The armoury item types on the other hand replace specific parts of the body meshes of the agent. The remaining item types are horses, animals, goods and books. Keep in mind that an item is not intended to have more than one item type. Also, you cannot declare a new weapon, armour or horse item type, you can only repurpose the Native ones, which may or may not have the correct set of animations and AI behaviour associated with it.[3]

itp_type_one_handed_wpn itp_type_bow itp_type_arrows itp_type_head_armor itp_type_horse itp_type_goods
itp_type_two_handed_wpn itp_type_crossbow itp_type_bolts itp_type_body_armor itp_type_animal itp_type_book
itp_type_polearm itp_type_thrown itp_type_bullets itp_type_foot_armor
itp_type_shield itp_type_pistol itp_type_hand_armor
itp_type_musket

While the weapon and armoury item types as well as the item class horse are pretty self-explanatory, the three rather unusual item classes animals, goods and books might irritate you and shall get explained shortly:

  • itp_type_animal: Animals are basically the same as Horses regarding the animations and the item entry. The difference is that agents with this flag instead of itp_type_horse can't be mounted by human agents (the dialog box to mount does not appear) and the item can appearantly also not be used at the food slot (see the section Food Slots for the details) in case you have reactivated that one.
  • itp_type_book: Books serve no purpose in the M&B game series except for being items to raise the player's character stats. They can either appear in form of readable or reference books. Readable books are one time use objects giving the player an one-time skill or attribute bonus after the book has been read completely. Reference books on the other hand give the player a skill bonus while he has the book in his inventory. At both kind of books you need to take care that you have placed new books alongside the others, respecting the declared constants in module_constants.py.
  • itp_type_goods: Goods summarise all food and manufactured items, excluding armoury, which are getting sold by merchants in the villages or towns or looted when raiding a caravan or a bandit lair. They are either needed for provision or for trade purposes and are also used a couple of times as quest items. Goods affect with their weight the travel speed at the world map.

Item Stats

In this segment you will find a comprehensive list of stats and a breakdown of their function.[4] As some stats mean different things for different item types, the list is organised by item types.

Generally
abundance - Percentage value: This stat governs how often the item will appear in merchant inventories and combat loot. 100 is standard; it can be more or less than 100 (down to 0), as 100 does not mean that it will show up 100 % of the time. Currently I do not know the ceiling number that equals 100 %.
weight - Kilogramme value: Defines the weight of the item in kilogrammes. The item weight limit of the Native Module System is 63.75 kg with a precision of up to 0.1 kg. Expanded Module Systems can have a higher weight limit up to 655.35 kg with a precision of up to 0.01 kg. Note that the game engine will round displayed weight to nearest 0.1 kg anyway.
itp_type_horse
body_armor - Value: Determines the horse's armour rating and number of hit points. A higher value means more armour and more hit points.
difficulty - Value: Determines how high the player's Riding skill needs to be to be able to mount this horse.
horse_speed - Value: The horse's speed on the battle map. Higher values make faster horses.
horse_maneuver - Value: The horse's manoeuvrability on the scene, the battle map.
horse_charge - Value: Determines how much damage the horse will do when charging infantry, and how much speed the horse will lose during each collision with an infantryman. Higher values will allow horses to do more damage and wade through more infantry.
itp_type_animal
body_armor - Value: Determines the horse's armour rating and number of hit points. A higher value means more armour and more hit points.
horse_speed - Value: The horse's speed on the battle map. Higher values make faster horses.
horse_maneuver - Value: The horse's manoeuvrability on the scene, the battle map.
horse_charge - Value: Determines how much damage the horse will do when charging infantry, and how much speed the horse will lose during each collision with an infantryman. Higher values will allow horses to do more damage and wade through more infantry.
itp_type_one_handed_wpn / itp_type_two_handed_wpn / itp_type_polearm
difficulty - Value: The minimum STR score needed to be able to use this weapon. If an agent does not have greater or equal STR, he will not be able to wield it.
spd_rtng - Value: The attack speed of the weapon, both swing and thrust.
weapon_length - Centimetre value: The length of the weapon in centimetres. This stat determines how far the weapon will be able to reach in-game, regardless of the mesh size.
swing_damage - Value, damage type: The base damage and damage type of the weapon when performing a swing attack.
thrust_damage - Value, damage type: The base damage and damage type of the weapon when performing a thrust attack.
itp_type_bow
difficulty - Value: The minimum Power Draw score needed to be able to use this bow. If an agent does not have greater or equal Power Draw, he will not be able to wield it.
spd_rtng - Value: The bow's reloading speed. In example, how fast an agent will be able to take an arrow from quiver, notch, and draw the bow again. Higher values will mean quicker reload times.
shoot_speed - Value: The speed at which ammunition from this weapon flies through the air. Higher values will mean faster ammunition; note, however, that very fast ammunition may clip through nearby enemies without hitting them, so try to keep it below 200m/s.[5] High shot speed will mean the projectile has less drop and so goes further.
thrust_damage - Value, damage type: The base damage and damage type inflicted by hits from this weapon.
accuracy - Percentage value: The chance of a shot flying exactly at the agent's aiming point. 100 represents a 100 % chance, lower values will greatly decrease the chance of a hit. This is not used on the Native bows and crossbows, but can be added.
max_ammo - Value: Bows can have such an entry but it won't affect anything. You can use it like a hidden parameter, to retrieve it with the operation item_get_max_ammo in some of your scripts. The value won't be displayed anywhere in-game but could spare one slot declaration.[6]
itp_type_crossbow
difficulty - Value: The minimum STR score needed to be able to use this crossbow. If an agent does not have greater or equal STR, he will not be able to use it.
spd_rtng - Value: The crossbow's reloading speed. In example, how fast an agent will be able to take a bolt from quiver, notch, and pull back the string for firing. Higher values will mean quicker reload times.
shoot_speed - Value: The speed at which ammunition from this weapon flies through the air. Higher values will mean faster ammunition; note, however, that very fast ammunition may clip through nearby enemies without hitting them, so try to keep it below 200m/s.[5] High shot speed will mean the projectile has less drop and so goes further.
thrust_damage - Value, damage type: The base damage and damage type inflicted by hits from this weapon.
accuracy - Percentage value: The chance of a shot flying exactly at the agent's aiming point. 100 represents a 100 % chance, lower values will greatly decrease the chance of a hit. This is not used on the Native bows and crossbows, but can be added.
max_ammo - Value: The number of bolts that can be fired from this crossbow before it must be reloaded.[7] The maximum ammo is 255.[8]
itp_type_arrows / itp_type_bolts
weapon_length - Centimetre value: The length of the arrow in centimetres. Modifies how deep the arrow goes into the target (so bolts for example don't go all the way in on impact)
thrust_damage - Value, damage type: The amount of damage this type of arrow adds to the bow's base damage, and the damage type.
max_ammo - Value: The number of arrows in one stack. The maximum ammo is 255.[8]
itp_type_thrown
difficulty - Value: The minimum Power Throw score needed to be able to use this weapon. If an agent does not have greater or equal Power Throw, he will not be able to use it.
spd_rtng - Value: The reloading rate for this weapon. In example, how fast the next piece of ammunition can be readied for throwing.
shoot_speed - Value: The speed at which this weapon's ammunition flies through the air.
weapon_length - Centimetre value: The weapon's length in centimetres.
thrust_damage - Value, damage type: The base damage and damage type inflicted by hits from this weapon.
max_ammo - Value: The number of weapons (ammunition) contained in one stack. The maximum ammo is 255.[8]
itp_type_shield
difficulty - Value: The minimum Shield skill score needed to be able to use this shield. If an agent does not have greater or equal Shield skill, he will not be able to wield it. You need to add difficulty(X) alongside the other stats for it to appear since it's not implemented at Native items.[9]
hit_points - Value: The base number of hit points for this shield.
body_armor - Value: The amount of damage subtracted from every hit to the shield.
spd_rtng - Value: The speed with which the shield can be brought up into defensive mode.
weapon_length - Value: Shield coverage, shield width. Higher values allow the shield to cover more body area, offering shield protection from arrows to larger sections of the body. Take note that it's the radius or half-width of the shield.[10]
shoot_speed - Value: Shield coverage, shield height. Needed for rectangular shaped shields to combine height with width. Use width only for round shields.[11]
itp_type_pistol / itp_type_musket
Keep in mind that pistols and muskets use the same bullets munition type and same firearm proficiency, which is hard-coded into the game engine.[12]
difficulty - Value: Warband does not specify the attribute/skill requirement for firearms. If you set the value higher than 0 you will make the weapon unuseable.
spd_rtng - Value: The pistol's reloading speed. In example, how fast an agent will be able to reload the pistol and aim it again.
shoot_speed - Value: The speed at which ammunition from this pistol flies through the air. High shot speed will mean the projectile has less drop and so goes further.
thrust_damage - Value, damage type: The base damage and damage type inflicted by hits from this pistol.
accuracy - Percentage value: The chance of a shot flying exactly at the agent's aiming point. 100 represents a 100 % chance, lower values will greatly decrease the chance of a hit.
max_ammo - Value: The number of bullets that can be fired from this pistol before it must be reloaded. The maximum ammo is 255.[8]
itp_type_bullets
Note that you always need to tag a mesh as ixmesh inventory for bullets, so a ("cartridge_a", ixmesh_inventory) instead of the more commonly-styled ("cartridge_a", 0), or you get a niche bug with the bullets leaving their flying mesh in the scenery.[13]
weapon_length - Centimetre value: The length of the bullet in centimetres. Modifies how deep the bullet goes into the target (so bolts for example don't go all the way in on impact)
thrust_damage - Value, damage type: The amount of damage this type of bolts adds to the bow's base damage, and the damage type.
max_ammo - Value: The number of bolts in one stack. The maximum ammo is 255.[8]
itp_type_head_armor / itp_type_body_armor / itp_type_foot_armor / itp_type_hand_armor
head_armor - Value: The amount of damage this piece of armour will prevent to the head of the agent.
body_armor - Value: The amount of damage this piece of armour will prevent to the body of the agent.
leg_armor - Value: The amount of damage this piece of armour will prevent to the legs of the agent.
difficulty - Value: The minimum STR required to wear this piece of armour.
itp_type_goods
food_quality - Value: The impact a food item will have on party morale. Values above 50 will improve morale while the item is being consumed, lower values will lower morale.
max_ammo - Value: The number of consumable parts for this item.

Item Properties

There exists a list of item property flags which assigns specific properties to each item. You have to differentiate here between item property type flags, which specify the type of the item as you can find them at the section about the item stats, and more genuine item property flags as they are listed below, in alphabetic order:

itp_always_loot ensures that the item will always appear in the normal post-battle loot screen.
itp_attach_armature needed for rigged items.(?)
itp_bonus_against_shield multiplies the damage by 2.0 when striking vs shields and by 1.1 vs destructible constructions.[14]
itp_can_penetrate_shield enables the item to penetrate shields. It is only for ammunition.
itp_can_knock_down gives the weapon a chance to knock down the enemy.
itp_cant_reload_on_horseback prevents reloading the weapon while being on horseback.
itp_cant_reload_while_moving forces the player to stand still for reloading the weapon.
itp_cant_reload_while_moving_mounted forces the player to stand still with his horse for reloading the weapon.
itp_cant_use_on_horseback disables the item to be used on horseback.
itp_civilian marks civilian cloths and/or armour which will get worn by hero-troops whose spawn records at the mission templates have the mission template alter flag af_require_civilian, commonly used at missions which play indoors (court, wedding).
itp_consumable marks consumable items which perish slowly with each day. Used in Native Module System in an inconsistent way.
itp_couchable makes spear/lance couchable, couched lance damage will be applied at successful attacks.
itp_covers_beard removes beard mesh for armours only.
itp_covers_head removes head mesh.
itp_covers_hair removes hair mesh for armours only.
itp_covers_hair_partially is a flag which has been introduced with VC, meant to fix the clipping issue from the flag before. For this it is using a vertex animation for the hair meshes and causes that one to switch to its alternate frame if it has one. Frame 1 needs the setting 10 for this, see the hairs at VC as examples.[15]
itp_covers_legs removes the leg meshes of the body. If you do not have this flag on a piece of body armor, it will load def_trousers as a submesh of the armor.[16] It's a purple default mesh which you can find in item_meshes1.brf.[17]
itp_crush_through affects that the melee weapon can break through blocks, dealing damage and stuns over a shield or weapon block. It does not happen always though, it depends on the speed bonus, the resistance of the shield, and some luck. It tends to occur against a shield in most cases, and very rarely against weapons. When on foot, only the overhead swing can result in a crushing blow. The treshold value for the required minimum damage for it can be set via the option crush_through_treshold = 2.4 in module.ini.
itp_default_ammo sets this item as default ammo, like a specific bolt for all crossbows. Without an additional ammo pack, the preloaded bolt will be the default ammo.
itp_disable_agent_sounds disable agent related sounds, but not voices. It affects only horse agents, not human agents, so useful for implementing other animals than horses.
itp_doesnt_cover_hair lets the item not cover the hair. Clipping will probably occur, not sure what the difference is to not having this flag set at all.
itp_extra_penetration is - based on the given informations - a flag introduced with WFaS which adds a multiplicator to the attack damage. The multiplicators can be set in module.ini, the respective lines are extra_penetration_factor_soak = 1.0 and extra_penetration_factor_reduction = 1.0. In Native there are no extra penetration flags set, so they are kept ineffective.[18] This flag can be added to any weapon but not to ammunition and shields.
itp_fit_to_head should deform the helmet item such way that it adapts to the form of the head mesh. Up for research.
itp_food lets the item give a morale bonus to the party. Used in Native Module System in an inconsistent way.
itp_force_attach_left_forearm attaches the item mesh of the drawn item to the left arm.
itp_force_attach_left_hand attaches the item mesh of the drawn item to the left hand.
itp_force_attach_right_hand attaches the item mesh of the drawn item to the right hand.
itp_force_show_body forces showing body (works on body armour items).
itp_force_show_left_hand forces showing left hand (works on hand armour items).
itp_force_show_right_hand forces showing right hand (works on hand armour items).
itp_has_bayonet adds two special agent animations when switching between weapon modes, equip_bayonet when switching to the secondary weapon mode and unequip_bayonet when switching back. Without this flag the weapon mode switching happens instantly without any animation. Also, the flag itp_next_item_as_melee is needed to enable the secondand weapon mode.[19]
itp_has_upper_stab sets at overswing attacks the values of the thrust damage fields instead of the swing damage fields at the item entry.
itp_ignore_friction prevents the item to get slowed down by the air.
itp_ignore_gravity prevents that trajectory bends the item downwards, so it becomes weightless. Disables effectively a bullet drop.
itp_is_pike allows for a new attack animation when crouching, pike bracing.
itp_merchandise makes an item available in shops.
itp_next_item_as_melee lets the weapon use the next item as melee weapon, it has to have the same mesh though. You can only toggle from ranged to melee or from melee to melee.[20]
itp_no_blur removes the blur effect when swinging a spear.
itp_no_parry adds the description "Can't be used to block" to the item. It does not disable the parry function of the item, for this you need to ensure that there are no itc-parry-flags assigned to the item.
itp_no_pick_up_from_ground prevents that the player can pick up this item from the ground.
itp_offset_lance moves the polearm forward, holding it further down the shaft, for couching purposes.
itp_offset_musket flips item upside down, offset -20 + weapon_length
itp_penalty_with_shield gives a damage penalty when used with a shield.
itp_primary is marking a weapon such way that Troops who are equipped with it will consider it when choosing a primary melee weapon from their inventory listing. This flag is necessary so that troops are able to wield this weapon!
itp_remove_item_on_use is for ammo like bolts, arrows and throwables. After a battle ends they won't refill normally. The operation agent_refill_ammo won't refill it neither.[21]
itp_secondary is deprecated and unused.
itp_two_handed lets the player carry only this item actively, so it is not possible to carry additionally a shield type item.
itp_unbalanced enables that the weapon can't cancel hits mid-swing and also delays blocking when an attack has been finished.
itp_unique ensures that the item cannot be looted via the normal post-battle loot screen.
itp_wooden_attack gives the weapon a wooden sound at attacking.
itp_wooden_parry gives the weapon a wooden sound at parrying.

Item Capabilities [22]

The capabilities of items, so basically what moves you can make with specific items, are set by the item capability flags, in short itcf's. These flags are used for attack and defend animations and determine also the carry position of a weapon. Take note that the idle stance and movement animations are not influenced by itcf's but by the item property type flags.[23] itcf's are getting complemented by itc's, the item capabilities, which are a combination of item capability flags and/or other item capabilities. So basically, taking the Bastard Sword of the Native Module System as an example, all the itc_bastardsword is actually doing is combining two-handed and one-handed capabilities. Here is the entry in module_items.py of the weapon:

								
									["bastard_sword_a", "Bastard Sword", [("bastard_sword_a",0),("bastard_sword_a_scabbard", ixmesh_carry)], itp_type_two_handed_wpn|itp_merchandise| itp_primary, itc_bastardsword|itcf_carry_sword_left_hip|itcf_show_holster_when_drawn,
294 , weight(2.0)|difficulty(9)|spd_rtng(98) | weapon_length(101)|swing_damage(35 , cut) | thrust_damage(26 , pierce),imodbits_sword_high],

Taken from header_items.py:

								
									itc_bastardsword = itc_cut_two_handed |  itcf_thrust_twohanded | itc_parry_two_handed |itc_dagger
								
							

So itc_bastardsword is a combination of a few other combined capabilities and a non-combined capability (the itcf_thrust_twohanded). Well, itc_bastardsword is obviously no good if you don't want the weapon to have a thrust attack. Instead you want one without the itcf_trust_twohanded. Oh, itc_nodachi has that:

								
									itc_nodachi = itc_cut_two_handed | itc_parry_two_handed
								
							

Good. But what about the itc_dagger thing then?

								
									itc_dagger = itc_cleaver | itcf_thrust_onehanded
								
							

Ah, so all you actually need is itc_nodachi and itc_cleaver. Hmm...

								
									itc_morningstar = itc_cut_two_handed |  itc_parry_two_handed |itc_cleaver
								
							

There is your itc. Of course, one could just have said "it's itc_morningstar", but then you wouldn't have learned anything from it. Basic rule, always check the appropriate header files for the details when dealing with stuff like that or read the explanations at the beginning of the file, ike in this case the one of field five in the item tuple:

								
									5) Item capabilities. Used for which animations this item is used with. See header_items.py for a list of available flags. 
								
							

You can of course simply define some new combined flags which will make adding these flags to weapons a lot easier.[24] Take however note that you cannot add new itcf flags, they are hard-coded into the game engine.[25] It is also recommended to check first for the already existing flags and look up their usage at the Native items before creating own new definitions. At the M&B game engine you have the following item capability flags available for weapon attacks:

itcf_thrust_onehanded itcf_thrust_twohanded itcf_thrust_polearm itcf_thrust_onehanded_lance
itcf_overswing_onehanded itcf_overswing_twohanded itcf_overswing_polearm itcf_horseback_slash_polearm
itcf_slashright_onehanded itcf_slashright_twohanded itcf_slashright_polearm itcf_horseback_slashright_onehanded
itcf_slashleft_onehanded itcf_slashleft_twohanded itcf_slashleft_polearm itcf_horseback_slashleft_onehanded
itcf_shoot_bow itcf_throw_stone itcf_reload_pistol itcf_overswing_spear
itcf_shoot_crossbow itcf_throw_knife itcf_reload_musket itcf_overswing_musket
itcf_shoot_pistol itcf_throw_axe itcf_thrust_musket
itcf_shoot_musket itcf_throw_javelin
itcf_shoot_javelin [26]

Take note that itcf_throw_axe and itcf_throw_knife will also spin the item (with the knife letting the mesh stuck in body the opposite side the axes would), while itcf_throw_stone won't leave a projectile behind when it hits something.[27]

The flags itcf_horseback_thrust_onehanded, itcf_horseback_overswing_right_onehanded, itcf_horseback_overswing_left_onehanded and itcf_thrust_onehanded_lance_horseback are not getting used by the game engine and are thus deprecated.

Beside the above mentioned flags you have also the following item capability flags available for defend actions:

itcf_parry_forward_onehanded itcf_parry_forward_twohanded itcf_parry_forward_polearm
itcf_parry_up_onehanded itcf_parry_up_twohanded itcf_parry_up_polearm
itcf_parry_right_onehanded itcf_parry_right_twohanded itcf_parry_right_polearm
itcf_parry_left_onehanded itcf_parry_left_twohanded itcf_parry_left_polearm

Notice that an item does not necessarily need item capability flags which assign attack and defend actions to it. By giving an item only parry flags you will get a weapon with which you can only defend but not attack with.[28] Vice versa you can also create a weapon with which the player is not capable to parry. In a similar way you can create a weapon only useable by riders, by assigning merely the horseback-only (and perhaps normal parrying) capability flags to it, although you should be aware of that the AI will still try to use their weapons in this fashion while dismounted.[29]

The M&B game engine also offers a set of predefined "carry-positions" for modders to use. Each equippable item can be specified to be carried on one of 23 carry positions by setting the accordingly item capability flag. In contrast to the others before the game engine does not connect them with an animation but uses a set of hardwired positions and bones for the various wearable scabbards, quivers, etc.. So for each carry-location the game has a fixed bone and a fixed roto-translation to apply. The table below lists all available carry-locations to you, with additional informations about the attachment position, offset, rotation and, if applicable, move on the forward axis of the mesh. Mind that the mentioned values are thoroughly hardcoded, so they are not customizable.[30]

item capability flag attachment position offset rotation move on forward axis
itcf_carry_axe_back hb_thorax (-0.19, 0.29, -0.17) z by 32.4 deg, y by 180.0 deg -(weapon_length - 0.3)
itcf_carry_axe_left_hip hb_abdomen (0.21, 0.12, 0.14) y by 82.8 deg, z by 1.0 rad, y by 3.3415928 (?) rad -(weapon_length - 0.3)
itcf_carry_board_shield hb_thorax (-0.06, 0.18, -0.2) y by -189.0 deg, z by 90.0 deg
itcf_carry_bow_back hb_thorax (-0.05, 0.0, -0.19) z by -32.4 deg, y by -90.0 deg
itcf_carry_bowcase_left hb_abdomen (0.25, 0.03, -0.1) y by -252.0 deg, x by -0.25 rad, z by -48.6 deg
itcf_carry_buckler_left hb_abdomen (0.18, -0.1, -0.1) rotate y by 126.0 deg
itcf_carry_crossbow_back hb_thorax (0.19, 0.34, -0.155) z by -32.4 deg, y by 81.0 deg, z by 0.1 rad -(weapon_length + 0.5)
itcf_carry_dagger_front_left hb_abdomen (0.04, 0.25, 0.15) y by 9.0 deg, z by -2.5 rad, y by -0.05 rad
itcf_carry_dagger_front_right hb_abdomen (-0.04, 0.25, 0.15) y by -189.0 deg, z by -2.5 rad, y by 0.05 rad
itcf_carry_katana hb_abdomen (0.23, 0.15, 0.23) y by -82.8 deg, z by 1.5 rad, y by -0.2 rad
itcf_carry_kite_shield hb_thorax (-0.19, 0.04, -0.18) y by 189.0 deg, z by 63.0 deg
itcf_carry_mace_left_hip hb_abdomen (0.21, 0.12, 0.14) y by 82.8 deg, z by 1.0 rad, y by 3.3415928 (?) rad -(weapon_length - 0.1)
itcf_carry_pistol_front_left hb_abdomen (-0.07, 0.25, 0.15) y by 9.0 deg, z by -1.5 rad, y by -0.05 rad
itcf_carry_quiver_back hb_thorax (-0.05, 0.02, -0.17) z by 21.6 deg
itcf_carry_quiver_back_right hb_abdomen (-0.05, 0.03, -0.19) y by 9.0 deg, z by 1.1 rad, y by 180.0 deg
itcf_carry_quiver_front_right [31] hb_abdomen (-0.21, 0.15, 0.0) y by 82.8 deg, z by -2.5 rad, y by -0.2 rad
itcf_carry_quiver_right_vertical hb_abdomen (-0.23, 0.05, 0.0) y by 82.8 deg, z by 0.5 rad, y by -0.05 rad, x by 0.2 rad
itcf_carry_revolver_right hb_thigh_r (-0.1, 0.0, 0.05) y by -90.0 deg, z by 54.0 deg, y by -0.1 rad
itcf_carry_round_shield hb_thorax (-0.22, -0.06, -0.2) y by -179.82 deg, z by 63.0 deg
itcf_carry_spear hb_thorax (-0.19, 0.29, -0.17) z by 32.4 deg -0.67
itcf_carry_sword_back hb_thorax (-0.19, 0.29, -0.17) z by -147.6 deg
itcf_carry_sword_left_hip hb_abdomen (0.24, 0.1, 0.1) y by 88.2 deg, z by -2.2 rad, x by 0.12 rad, y by -0.2 rad
itcf_carry_wakizashi hb_abdomen (0.05, 0.19, 0.24) y by -126.0 deg, z by 1.8 rad, y by -0.2 rad
itcf_show_holster_when_drawn determines that the holster still gets shown when the weapon gets drawn, typically used to show the scabbards of swords, bowcases of bows bows, stacks of throwing weapons or holsters of revolvers.

Take note that the tool OpenBRF lets you simulate what will happen in-game, by placing and rigging the item in a carry-position of your choice. Below you can see a tool test by amassing suitable items over each one of the 23 predefined carry positions.[32]


Item Damage Types

As we have observed in the tuple examination, "practice_sword" does blunt damage. Obviously this is because it is a practice weapon, but it provides a good incentive to look into the different damage types available in M&B, to which weapons and ammunitions can get assigned to.

First, there is cut damage. Cut damage represents the slicing action of a sharp blade, such as a sword or an axe. Cut damage gets a bonus against unarmoured or lightly-armoured enemies, but conversely it has a large penalty against heavy armour. Cut damage will kill an enemy if it brings the enemy to 0 hit points.

Next we have blunt damage. Blunt damage represents the bludgeoning effect of weapons without an edge, such as a mace or hammer. Blunt damage gets a 50 % bonus against heavy armour, but blunt weapons are often shorter than cutting weapons and they do less damage overall. The largest advantage of blunt damage is that it knocks an enemy unconscious when the enemy is brought to 0 hit points, instead of killing him. Unconscious enemies can be captured and sold into slavery. There does even exist a special weapon order which tells troops to use blunt weapons. Charging horses also do blunt damage.

Finally, pierce damage represents the penetrating tip of arrows, crossbow bolts and similar weapons. Pierce damage gets a 50 % bonus against heavy armour, but piercing weapons usually do less damage overall in order to balance it with the other damage types. Pierce damage will kill an enemy if it brings the enemy to 0 hit points. It is also one of the hard-coded requirement for a weapon with which an agent can stop a horse and let it rear (the other conditions are that it needs to be a polearm with a minimum length of 1.3 m and the hit must have a minimum speed as determined by lance_pike_effect_speed in module.ini).

You can also influence how each damage type incluenfes the soak factor and the reduction factor of armour. Look up the settings armor_soak_factor_against_* and armor_reduction_factor_against_* at the module.ini documentation section.

Maximum Weapon Damage

As the ibf_damage_mask is 0x3ff and 2 bits are for damage type the maximum damage is 255. The Module System does damage & 0xFF to avoid the value leaking into the damage type bits, so that a 9999 damage is effectively cut down to 15 damage.[33]

								
									0010 0111 0000 1111 (9999)
&
0000 0000 1111 1111 (0xFF)
=
0000 0000 0000 1111 (15)

Item Modifiers

Modifiers are labels that precede the name of an Armor, Shield, Weapon, or Horse, indicating either specific bonuses or penalties to defense, damage, skill, attribute requirements, speed ratings and/or costs. Every item has the modifier plain which is the normal default item.[34] The available modifiers can all be found in header_item_modifiers.py and are listed in the tables below, at which more informations about their boni or penalties as well as their cost effects can be found too.

Take care that you differentiate between imods and imodbits and use them accordingly. The imodbits are the possible imods of the item. While an item entry gets assigned an imodbit (or multiple ones) at tuple field 8 of its item entry, it are at most (if not all) operations and scripts the imods for which you need to check for.[35] You add the possibility of an imod to be used or present on a item with the imodbit variable at the before mentioned tuple field on module_items.py. If you add a new sword you could have an entry similar to this one (the example shows a simple item entry without any item trigger or faction tuple field):

								
									["item", "Item", [("mesh",0)], ... , imodbits_sword],
								
							

Here the constant imodbits_sword gets used which is not one of the base modifiers but a predefined constant which you can find at the beginning of the file module_items.py. These defined constants consist of bundles of the standard item modifiers. You can of course still use only specific modifiers, decide to have none (using imodbits_none) at your item or define your own new constant, bundling anew some of the standard item modifiers. The following constants for modifiers have already been set for ease of use:

								
									imodbits_none = 0
imodbits_horse_basic = imodbit_swaybacked|imodbit_lame|imodbit_spirited|imodbit_heavy|imodbit_stubborn
imodbits_cloth = imodbit_tattered|imodbit_ragged|imodbit_sturdy|imodbit_thick|imodbit_hardened
imodbits_armor = imodbit_rusty|imodbit_battered|imodbit_crude|imodbit_thick|imodbit_reinforced|imodbit_lordly
imodbits_plate = imodbit_cracked|imodbit_rusty|imodbit_battered|imodbit_crude|imodbit_thick|imodbit_reinforced|imodbit_lordly
imodbits_polearm = imodbit_cracked|imodbit_bent|imodbit_balanced
imodbits_shield = imodbit_cracked|imodbit_battered|imodbit_thick|imodbit_reinforced
imodbits_sword = imodbit_rusty|imodbit_chipped|imodbit_balanced|imodbit_tempered
imodbits_sword_high = imodbit_rusty|imodbit_chipped|imodbit_balanced|imodbit_tempered|imodbit_masterwork
imodbits_axe = imodbit_rusty|imodbit_chipped|imodbit_heavy
imodbits_mace = imodbit_rusty|imodbit_chipped|imodbit_heavy
imodbits_pick = imodbit_rusty|imodbit_chipped|imodbit_balanced|imodbit_heavy
imodbits_bow = imodbit_cracked|imodbit_bent|imodbit_strong|imodbit_masterwork
imodbits_crossbow = imodbit_cracked | imodbit_bent|imodbit_masterwork
imodbits_missile = imodbit_bent|imodbit_large_bag
imodbits_thrown = imodbit_bent|imodbit_heavy|imodbit_balanced|imodbit_large_bag
imodbits_thrown_minus_heavy = imodbit_bent|imodbit_balanced|imodbit_large_bag
imodbits_horse_good = imodbit_spirited|imodbit_heavy
imodbits_good = imodbit_sturdy|imodbit_thick|imodbit_hardened|imodbit_reinforced
imodbits_bad = imodbit_rusty|imodbit_chipped|imodbit_tattered|imodbit_ragged|imodbit_cracked|imodbit_bent

A short look reveals the constant imodbits_sword of the example item entry above is a bundle out of imodbit_rusty, imodbit_chipped, imodbit_balanced and imodbit_tempered. This results in-game into the appearance of "rusty", "chipped", "balanced" and "tempered" forms of the newly added sword. The items you find at merchants and in loot will draw their modifiers randomly from the to them assigned imodbits. This means vice versa that modifiers which are not listed in an item's modifier bits will not be considered for merchant inventory or battle loot. For more experienced modders, it is interesting to note that modifiers which aren't listed in an item's modifier bit can still be used with the operation troop_add_item. For example, longbows usually come only in "plain", "bent" and "cracked" forms; but if we were to add a longbow to the player's inventory with the modifier "balanced" on it, the player will receive a balanced longbow.

Take note that imods are just a hard-coded way to give boni or penalties to your items because the effects are hard-coded. While you cannot alter the effects you can rename the item modifiers and edit the price factor and the rarity of them. For this, copy the file item_modifiers.txt (path: "game folder/Data/item_modifiers.txt") to the Data folder of your mod (path: "game folder/module/mymod/Data").[36] It contains lines as follows:

								
									imod_plain Plain_%s 1.000000 1.000000
imod_cracked Cracked_%s 0.500000 1.000000
imod_rusty Rusty_%s 0.550000 1.000000
...
imod_large_bag Large_Bag_of_%s 1.900000 0.300000

The first field is the imod ID, the second is name, the third is the price modifier with the plain imod as reference (so how many times more expensive than a plain item is an item with the respective modifier) and the fourth field is the rarity. Modify the fields two to four to your likings. While you cannot change the effects of modifiers, you can always add custom effects with triggers on a mission template which give an agent other boni or penalties based on the imod of their items or horse.[37]

There are different opinions about the usage of hard-coded modifiers. Some see no use for them except for the above mentioned built-in loot and merchandise randomization. Others however use them either to create item variants, as shall be explained in the upfollowing paragraphs, or to "factionalize" items without creating a bunch of variants, especially if one repurposes some unused item modifiers that have no effect on item stats (to which we come later). It might also prove useful where you have just updated graphical resources and the new ones can be marked as the plain default mesh while the outdated ones can be marked by imodbits_bad. The downside is that you can't use them as equipment overrides or re-equip agents with them or display them on item mesh overlays.[38]

Using Modifiers for Item Variants [39]

Beside their effects on stats and costs, modifiers enable you to have a variety of different skins for a item by adding multiple meshes to the respective tuple fields, referencing a modifier bit out of the ones at tuple field 8. Add it as follows at tuple field 3:

								
									["item", "Item", [("mesh",0),("mesh_a",imodbit_rusty),("mesh_b",imodbit_chipped),("mesh_c",imodbit_balanced)], ... , imodbits_sword],
								
							

Now every time the item is pulled randomly and is imodbit_rusty, it shows up with the mesh_a mesh, every time it randomly appears in a merchants inventory as "balanced" it is the mesh_c mesh. You get the idea. The modifier plain is, as mentioned before, the normal default item, the zero behind the mesh name has actually the same effect as an imodbit_plain. You can also assign directly a specific item modifier via an operation. At this place it is recommended to look into (a documented version) of header_operations.py and look up all available operations at which the imodbit can play a role via the keyword item_modifier. Take note that you can also add a mesh variant at scabbards (and probably at inventory and flying projectiles too), given the respective item has such:

								
									["item", "Item", [("mesh",0),("mesh_scabbard", ixmesh_carry),("mesh_a",imodbit_rusty),("mesh_a_scabbard", ixmesh_carry|imodbit_rusty), ...], ... , imodbits_sword],
								
							

Why does this all come in handy? Well, you can edit an armour or a weapon mesh just slightly to reflect its condition, then associate it this way so it really looks like tagged with that condition. For example you can make a mesh reflecting a ragged leather that actually looks ragged or a rusty sword with rust on it. This mixes up a bit the visuals in-game. By adding all the meshes to one item, they (and their values) are all associated with one item entry. So various swords with roughly the same stats can all be called in the class of 'longsword' or 'shortsword' or 'bastard sword' but allow different visuals.[40]

At Vanilla M&B, so the predecessor of M&B Warband, this functionality could also be used to circumvent the maximum number of items which modders could add to the game. This limit is at 915 but is not directly given anymore at Warband.[41] Instead the maximum number of items you can have equals the number of scene props you have defined.[42] Otherwise you will face an indirect item limit in the multiplayer at dropping a weapon: Items dropped on the ground can then change identities but that apparently only happens after the benchmark of 2048 items is hit.[43] It is a known bug, but TaleWorlds refused to fix it because it would break client-server compatibility. Adding dummy scene props will however raise the limit for droppable items,[44] see the subsection Items as Scene Props below for more informations.

Armour Modifiers

Cloth and leather can typically receive Tattered, Ragged, Sturdy, Thick or Hardened while metallic armor can be Rusty, Battered, Crude, Thick, Reinforced and Lordly. Cracked is only used on heavy metal armor made from plates.

Modifier Bonus Costs
Lordly +6 +1050 %
Reinforced +4 +550 %
Hardened +3 +290 %
Thick +2 +160 %
Sturdy +1 +70 %
Crude -1 -17 %
Battered -2 -30 %
Ragged -2 -30 %
Rusty -3 -45 %
Tattered -3 -50 %
Cracked -4 -50 %

Weapon Modifiers

Weapons which have no requirement do not gain one from the Heavy, Strong, or Masterwork modifiers. For instance, while a Masterwork Short Bow has a Power Draw requirement of 5 rather than 1, a Masterwork Hunting Bow, like a standard Hunting Bow, has no Power Draw requirement.

Modifier Requirement Speed Damage Costs
Masterwork +4 +1 +5 +1650 %
Tempered - - +4 +670 %
Strong +2 -3 +3 +360 %
Balanced - +3 +3 +250 %
Heavy +1 -2 +2 +90 %
Chipped - - -1 -28 %
Rusty - - -3 -45 %
Bent - -3 -3 -35 %
Cracked - - -5 -50 %

Ammunition Modifiers

The quantity increase is rounded down to the nearest integer, with a minimum of +1. For example, a Large Bag of Arrows will have 34 in a quiver instead of the standard 30: 30*1.15=34.5, the .5 is truncated to leave 34. Thrown Axes normally have four in a bundle, but a Large Bag of Thrown Axes will have five: 4*1.15=4.6; since .6 is less than 1, it receives the minimum value of +1.

Modifier Quantity Damage Costs
Large Bag +13 % - +90 %
Bent - -3 -35 %

Due to their status as ranged and melee weapons as well as ammunition, some throwing weapons can benefit from the Large Bag modifier as well as the Balanced or Heavy modifier. When the Bent modifier is applied, it is taken from the Weapon Modifiers table above, rather than the Ammunition Modifiers table.

Shield Modifiers

Contrary to armor, weapon, and projectile modifiers, shield modifier can change. If a shield is destroyed in battle, it may become "deformed", losing a positive trait or gaining a negative one.

Modifier Durability Resistance Costs
Reinforced +83 +4 +550 %
Thick +47 +2 +160 %
Battered -26 % -2 -25 %
Cracked -56 -4 -50 %

These are the only possible shield modifiers. Shields described as "Old", "Heavy", or "Plain" are not modified, but rather a completely different item that can still carry any one modifier listed in the table above.

Horse Modifiers

A horse "killed" in battle may lose its current modifier and become Lame. After the battle, an unused Lame horse in the inventory will recover over time to become a standard one, without any modifier.[45] This also means buying a Lame horse may be a good idea if it stays in the inventory for enough time, resulting in a standard horse later for less than half the price. Purposely killing a Swaybacked horse in order to make it Lame then having it heal back to normal is also a discount compared to regular prices, although there is a risk of losing the horse altogether.

Beneficial modifiers are a costly addition to the more expensive horses and one should be careful when using one in combat as a Lame horse will never recover back into a Champion. There is also the risk of the horse simply dying outright, thus wasting all the money put into it.

Modifier Armour Speed Maneuver Charge Hit Points Requirement Costs
Champion - +4 +2 +2 - +2 +1350 %
Spritied - +2 +1 +1 - - +550 %
Heavy +3 - - +4 +10 - +90 %
Stubborn - - - - +5 +1 -10 %
Swaybacked - -4 -2 - - - -40 %
Lame - -10 -5 - - - -60 %
Meek - 0 - - - - ?
Timid - 0 - - - - ?

Timid and Meek are at Native inactive modifiers for horses and can be activated via their entries in module.ini:

								
									timid_modifier_speed_bonus = 0
meek_modifier_speed_bonus = 0

Changing the values to any other value gives horses with these modifiers the respective speed bonus or penalty.

Food Modifiers

Food modifiers can be applied manually but have also their own effects while the days pass. The following modifiers are given:

								
									imod_fresh = 37
imod_day_old = 38
imod_two_day_old = 39
imod_smelling = 40
imod_rotten = 41

The game checks now for some specific food items what their current modifier is and edits it with days passing. For this a trigger is used which can be found in module_simple_triggers.py:

								
									# Setting item modifiers for food
(24,
[
  (troop_get_inventory_capacity, ":inv_size", "trp_player"),
  (try_for_range, ":i_slot", 0, ":inv_size"),
      (troop_get_inventory_slot, ":item_id", "trp_player", ":i_slot"),
      (this_or_next|eq, ":item_id", "itm_cattle_meat"),
      (this_or_next|eq, ":item_id", "itm_chicken"),
      (eq, ":item_id", "itm_pork"),
      (troop_get_inventory_slot_modifier, ":modifier", "trp_player", ":i_slot"),
      (try_begin),
          (ge, ":modifier", imod_fresh),
          (lt, ":modifier", imod_rotten),
          (val_add, ":modifier", 1),
          (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", ":modifier"),
      (else_try),
          (lt, ":modifier", imod_fresh),
          (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", imod_fresh),
      (try_end),
  (try_end),
]),

This trigger is getting active every 24 hours. It affects only specific food items (cattle meat, chicken, port) and checks if the item has an modifier with a value between 37 (including the modifier fresh) and 41 (excluding the modifier rotten). If so, the modifier will go on one step, so for example a one-day-old (38) chicken will become a two-day-old (39) chicken. If the food item has no modifier yet at all, the modifier fresh will be set (else_try part) and the item will find its way into the other circulation at the next day.

Unused Modifiers

Some extra modifiers exist in the code but are not used. These include: Cheap, Poor, Deadly, Powerful, Exquisite, Rough, Fine, Sharp, Meek, Superb, Old, Timid, Plain, Well-Made. It seems likely that Old and Plain were intended for shields before those words were simply incorporated into specific types of shields. Timid and Meek are for horses and can be activated as mentioned above.

Except for imod_fine (adds +1 dmg) they are all deprecated and have no effect on weapons. Since it is not possible to create new weapon modifiers it is however an option to give those unused ones manually a "second life" via:

								
									(troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
(eq, ":item_modifier", imod_deadly),

This way it would be possible to create for example an NPC whose weapon is having a "deadly" modifier. In a mission templates you can create a ti_on_agent_hit trigger that instantly kills the target if it has less than 50 % hp and if it was hit with mentioned weapon. Of course the "deadly" modifier can't appear on weapons on the usual way, so this feature will be kinda unique. It's just an example but you get the idea.[46]

Usage of ixmesh

In header_items.py you will find three ixmesh flags which can be used to assign extra mesh IDs to the item entry. Mesh names accompanied by a "0" are indicating the base mesh which is getting used normally when the item appears in-game.

  • ixmesh_carry is getting used to assign an extra mesh to the weapon item entry which is getting used when the player hasn't drawn the weapon and is just carrying it at his body. Usually used for scabbards, bows, throwing weapons, quivers and bolt bags. Take note that scabbards, quivers and bolt bags are making use of vertex animations to work properly, and that ixmesh_carry cannot be used at crossbows.[47]
  • ixmesh_flying_ammo is typically getting used at arrows, bolts, throwing and if given bullet item entries. With this entry you can control which mesh is getting used for flying projectiles, so in mid-air. Usually the flying missile mesh is the same as the weapon, arrow or bolt or is a simpler, less performance heavy shape. Be aware that you are not able to assign particle systems to flying projectiles.[48]
  • ixmesh_inventory is getting used to set a different mesh for the inventory picture. That way you can use multimeshed or rigged items but still have them oriented and textured correctly in the inventory.[49] The ixmesh_inventory mesh also always matches the icon of the game UI ammo icon which is otherwise showing the main mesh.[50] Additionally it is the mesh which will appear as the spawned item.[51]

Item Extra Description

You might have an item to which you want to add some kind of description, giving the player some additional informations about the item. When you see the weapon information, you can see there the stats and things like Unbalanced or Can crush trough blocks. For this you need to edit the script game_get_item_extra_text.[52] The item description at the popup text is working in a callback style, meaning that the script gets called every time an item detail frame is displayed. It returns a string using

								
									(set_result_string,"@this thingie will be displayed at the bottom ^_^"),
								
							

and optionally you can also specify the custom color by using, for example, (set_trigger_result, 0x00ff7f).[53] You can also set up a bunch of definitions (in module_constants.py) for the range of your newly added items (for example artifacts), and then put their descriptions strings in the same order as the items (in module_strings.py). Then, by finding the offset, you can easily find the description:[54]

								
									  (else_try),
      (is_between, ":item_no", artifacts_begin, artifacts_end),
      (try_begin),
          (eq, ":extra_text_id", 0),
          (store_sub, ":offset", ":item_no", artifacts_begin), #get offset
          (val_add, ":offset", "str_atrifact_1"), #get string
          (set_result_string, ":offset"),
          (set_trigger_result, 0xFFEEDD),
      (else_try),

Item Triggers

At the optional tuple field 9 of the item entry you can add one or a list of simple triggers which are then associated with the item. As the file header_triggers.py shows, there are four different simple triggers possible to be implemented here:[55]

  • ti_on_init_item contains the trigger parameter 1, the agent ID of the item wearer (-1 if none), and the trigger parameter 2, the troop ID of the item wearer (-1 if none). This trigger will run if a item is initialized, for example, in the inventory window or in scenes. This simple trigger does not work at horses, boots and gloves which implies that the operations cur_item_add_mesh and cur_item_set_material will also not work for them. Most commonly used for heraldic mail, heraldic shield and for the torch item.
  • ti_on_weapon_attack contains the trigger parameter 1, the agent ID of the item wearer, and the position register 1, the weapon items position of the weapon which performed the attack. This trigger will run if a item is used, for example, if you shoot a crossbow. It works on ranged and melee items and gets fired on attack release (so not on left-click but on left-click release).[56] Does not fire on client side in multiplayer missions.
  • ti_on_missile_hit contains the trigger parameter 1, the agent ID of the shooter who just fired the missile, trigger parameter 2, the object type it hits, and the position register 1, the position of the missile which just landed somewhere. This trigger will run if a missile lands somewhere, for example, if you shoot your bow and the arrow lands. It works only on projectiles (arrows, bolts, throwing) and not on launchers (bows, crossbows, muskets, pistols) (throwing weapons count as both, as a projectile and as a launcher, which enables this simple trigger for them). Not all hits will be registered on client-side in multiplayer missions. The different object type parameters are:
    • 0 none/world (landscape)
    • 1 hostile agent
    • 2 dynamic prop
    • 3 world/scene object (trees, stones, scene interior basic mesh)
    • 4 mission/static object (most scene props)
    • 5 blocked
    • 6 parried
    • 7 chambered
    • 8 friendly agent
    • 9 neutral agent
    • 10 under water
    You can use this simple trigger to create particle effects when the missile hits the ground, implementing something like
    									
    										(particle_system_burst,<par_sys_id>, pos1,[percentage_burst_strength]),
    									
    								
    into the item trigger.[57] Take note that it is not possible to get the instance of a flying missile.[58] Missiles have IDs but they are reused all the time - as soon as a missile hits, it's not valid anymore. In some cases (ground hit, scene prop hit) a mission object gets created, in some others (agent hit, shield hit, spawned prop hit) a mesh gets created, but in any case the actual missile is deleted.[59]
  • ti_on_shield_hit contains the trigger parameter 1, the agent ID of the receiver who carries the shield, the trigger parameter 2, the agent ID of the dealer who hit the shield, the trigger parameter 3, the inflicted damage on the shield, the trigger parameter 4, the item ID of the weapon (ranged weapon in case of ranged attack), and the trigger parameter 5, the item ID of the missile (ammo in case of ranged attack). If set_trigger_result is used in the code, the operation parameter will override the damage dealt to the shield.

All other simple triggers referencing items have to be called within a mission template and are therefore getting explained there.

Equipment Slots

There are in total ten equipment slots available. This amount is hard-coded into the game engine, you cannot add new ones. You can however create a workaround with slots. Take note that the food slot cannot be repurposed to something else, in Native it is currently deactivated (see the section Food Slot for more details). The following equipment slots are given:

								
									ek_item_0 = 0
ek_item_1 = 1
ek_item_2 = 2
ek_item_3 = 3
ek_head = 4
ek_body = 5
ek_foot = 6
ek_gloves = 7
ek_horse = 8
ek_food = 9

Maximum Inventory Items

In header_items.py you might have found the line maximum_inventory_items = 96. It might give you the impression that changing that number increases the maximum amount of items which a person can carry in his inventory. It is however just a contant that helps you to calculate the amount of items to offset by when playing with inventories. The actual limit of 96 is hard-coded.[60]

Books

If you think about adding new books it is the best to first look up how the other books are getting handled. As mentioned above there are two different kind of books, readable books and reference books. You will also see them sorted like this in the Native Module System:

								
									#This book must be at the beginning of readable books
 ["book_tactics","De Re Militari", [...],
 ["book_persuasion","Rhetorica ad Herennium", [...],
 ["book_leadership","The Life of Alixenus the Great", [...],
 ["book_intelligence","Essays on Logic", [...],
 ["book_trade","A Treatise on the Value of Things", [...],
 ["book_weapon_mastery", "On the Art of Fighting with Swords", [...],
 ["book_engineering","Method of Mechanical Theorems", [...],

#Reference books
#This book must be at the beginning of reference books
 ["book_wound_treatment_reference","The Book of Healing", [...],
 ["book_training_reference","Manual of Arms", [...],
 ["book_surgery_reference","The Great Book of Surgery", [...],

The two books at the beginning of each book kind have to be there since they are declared as the first item within their respective category in module_constants.py:

								
									reference_books_begin = "itm_book_wound_treatment_reference"
reference_books_end = trade_goods_begin
readable_books_begin = "itm_book_tactics"
readable_books_end = reference_books_begin
books_begin = readable_books_begin
books_end = reference_books_end

The best way to add your own books is to add it at the end of the respective category. Then do a full text search for a similar book to locate the scripts and the simple triggers which handle the books and their effects. You should find then the scripts game_get_item_extra_text and game_get_skill_modifier_for_troop or the simple trigger coming after the comment "# Read books if player is resting". There you add then your new books with their effects.

Keep in mind that a book doesn't need to be a book: You can also have a special artifact or such which gives a permanent skill bonus while being carried in the inventory, just like a reference book.

Morale Effect of Food [61]

Above we already discussed the existing food modifiers. You might now also want to alter the size of the morale effect of the single food items.[62] For this you can first take a look into the script get_player_party_morale_values in module_scripts.py. Filtering for the keyword "food" leaves you with the following code snippet:

								
									  (assign, "$g_player_party_morale_modifier_food", 0),
  (try_for_range, ":cur_edible", food_begin, food_end),
    (call_script, "script_cf_player_has_item_without_modifier", ":cur_edible", imod_rotten),
    (item_get_slot, ":food_bonus", ":cur_edible", slot_item_food_bonus),

    (val_mul, ":food_bonus", 3),
    (val_div, ":food_bonus", 2),

    (val_add, "$g_player_party_morale_modifier_food", ":food_bonus"),
  (try_end),
  (val_add, ":new_morale", "$g_player_party_morale_modifier_food"),

  (try_begin),
    (eq, "$g_player_party_morale_modifier_food", 0),
    (assign, "$g_player_party_morale_modifier_no_food", 30),
    (val_sub, ":new_morale", "$g_player_party_morale_modifier_no_food"),
  (else_try),
    (assign, "$g_player_party_morale_modifier_no_food", 0),
  (try_end),

You start out with a food morale modifier of 0 (line 1), so the calculation starts anew each time this script is getting called. For every item within the constants food_begin and food_end-1 (line 2) a script is called to check if the player has such item with a rotten modifier (line 3). If yes, the script fails (cf_scripts are can_fail_scripts), the loop is thus broken for this item and it continues with the next one. If not, the food bonus variable is fetched from slot_item_food_bonus (line 4), gets multiplied with 3 and divided by 2 (lines 6 and 7) and then added to the global variable summarizing the food morale modifier (line 9). If the script has looped through all food items it adds the total food morale modifier to the new morale (line 11).

Afterwards a check is getting done: If the player has no suitable food and thus a food morale multiplier of zero (line 14) the player gets a morale penalty of 30 assigned (line 15) which gets substracted of the new morale (line 16). Otherwise the penalty is set to 0 (line 18). If the player has no food in his inventory for multiple days in a row, his morale penalty gets therefore stacked up.

How to edit the morale effect of food? Multiple ways are pointed out above, depending on what you want to achieve. The two most obvious ones are either to edit the declared range of constants or to include new food items within it. To alter the amount of items getting checked you can edit the range of the food items by redefining the constants food_begin and/or food_end in module_constants.py. To re-enable drinks for example, you can change food_begin from "itm_smoked_fish" to "itm_wine". Make sure that you have your food items sorted accordingly in module_items.py.

Alternatively you can also alter the individual item food bonus. For this you have to watch out for the slot slot_item_food_bonus. That one gets initialized via the script initialize_item_info. There you find at the top the for us relevant code lines:

								
									# Setting food bonuses - these have been changed to incentivize using historical rations. Bread is the most cost-efficient
#Staples
(item_set_slot, "itm_bread", slot_item_food_bonus, 8), #brought up from 4
(item_set_slot, "itm_grain", slot_item_food_bonus, 2), #new - can be boiled as porridge

#Fat sources - preserved
(item_set_slot, "itm_smoked_fish", slot_item_food_bonus, 4),
(item_set_slot, "itm_dried_meat", slot_item_food_bonus, 5),
(item_set_slot, "itm_cheese", slot_item_food_bonus, 5),
(item_set_slot, "itm_sausages", slot_item_food_bonus, 5),
(item_set_slot, "itm_butter", slot_item_food_bonus, 4), #brought down from 8

#Fat sources - perishable
(item_set_slot, "itm_chicken", slot_item_food_bonus, 8), #brought up from 7
(item_set_slot, "itm_cattle_meat", slot_item_food_bonus, 7), #brought down from 7
(item_set_slot, "itm_pork", slot_item_food_bonus, 6), #brought down from 6

#Produce
(item_set_slot, "itm_raw_olives", slot_item_food_bonus, 1),
(item_set_slot, "itm_cabbages", slot_item_food_bonus, 2),
(item_set_slot, "itm_raw_grapes", slot_item_food_bonus, 3),
(item_set_slot, "itm_apples", slot_item_food_bonus, 4), #brought down from 5

#Sweet items
(item_set_slot, "itm_raw_date_fruit", slot_item_food_bonus, 4), #brought down from 8
(item_set_slot, "itm_honey", slot_item_food_bonus, 6), #brought down from 12

(item_set_slot, "itm_wine", slot_item_food_bonus, 5),
(item_set_slot, "itm_ale", slot_item_food_bonus, 4),

You can also see at the comments that the developer tried to bring some systematic into it and documented some little changes here. You can now either edit those numbers to be more to your liking and/or add respective lines of newly added food items and/or delete them vice versa.

Food Slot

foot slot spits out certain item (recheck since Somebody mentions out of order), check also if only specific things can be thrown into the food slot or everything. Hard-coded items, Somebody, Modding Q&A

Items as Scene Props

As noted above but to repeat it again with more details: the maximum number of items you can have equals the number of scene props you have defined.[42] Otherwise you will face an indirect item limit in the multiplayer at dropping a weapon: Items dropped on the ground can then change identities but that apparently only happens after the benchmark of 2048 items is hit.[43] The game engine chooses the number of bits used to send a mission object (scene prop, item...) by taking the highest scene prop id and calculating the number of bits required to store it. If there are many more items than props, some items ids will require more bits than the amount sent, which will result in them being sent truncated.[63] It is a known bug, but TaleWorlds refused to fix it because it would break client-server compatibility. Adding dummy scene props will however raise the limit for droppable items.[44]

_Sebastian_ has shared a python script which generates as much scene props as items. It needs to get added at the end of module_scene_props.py:[64]

								
									# generate dummy props to avoid item spawn issues on dedicated servers
from module_items import items
if len(scene_props) < len(items): #more items than props
    for i in range(len(scene_props), len(items)):
        scene_props += ("zyx_dummy_prop_"+str(i), 0, 0, 0, []),

Other Notes

These notes still need to be integrated at good places

Riders with daggers don't fight, daggers can't block, Somebody and dunde, Modding Q&A. What exactly defines a dagger, itp flag or weapon length? Or is it due to missing blocking itc flags?

arcs and heights throwing items, DanyEle, Modding Q&A, range of weapon, kraggrim (credit), Modding Q&A.

Projectile distance damage power with some testings at upfollowing page, Discussion and test, Modding Q&A.

damage value determines accuracy, Somebody, Modding Q&A, more accurate distance weapon, Zirkhovsky and MadocComadrin, Modding Q&A, and Willhelm (credit), Modding Q&A.

max weight of items, Vornne, Modding Q&A

attack speed, Lav, Modding Q&A

crush through, Ikaguia (credit), Modding Q&A, can crush through blocks, Somebody, Modding Q&A

no left handed weapons, Somebody, Modding Q&A

equipment and inventory slots, kalarhan, Modding Q&A

spears longer than 2.4 m need custom hitbox? jacobhinds, Modding Q&A

hard coded horse crippling, jacobhinds, Modding Q&A

Need to write down for the guide how power draw requirement limits the use of power draw skill. It's basically written at the list of available module skills but it should be marked more clear at the item section that a higher power draw requirement has a direct effect on this.

consumable items, kalarhan, Modding Q&A

bonus item requirements, kalarhan, Modding Q&A and Modding Q&A

item abundance value, Tegan (credit), How do I add items to merchants?.

weapon unsheatable, Somebody, Modding Q&A